<script setup lang="ts">
import { getCodeApi } from '@/apis/user'
import { request } from '@/utils/http'
import { useCounterStore } from '@/stores/counter'
import { ref } from 'vue';
import CustomPayment from '@/components/coustom-payment/custom-payment.vue'
const store = useCounterStore()

// 1. 测试网络请求
const testReq1 = async () => {
  const res = await request.post('/login/password', { mobile: '13211112222', password: 'abc12345' })
  console.log(res.data);
}

const testReq2 = async () => {
  const res = await getCodeApi({ mobile: '13211112222', type: 'login' })
  console.log(res.code)
}
const popupRef = ref()
const open = () => {
  popupRef.value.open()
}
const close = () => {
  popupRef.value.close()
}
const paymentRef = ref()
const clickFn = () => {
  paymentRef.value.open()
}
</script>

<template>
  <view class="test-page">
    <button disabled class="uni-button">点我吧</button>
    <text class="iconfont icon-edit"></text>
    <view class="uniui-icon-symbol-tool-03" style="width: 50px;height:50px;"></view>
    <button class="uni-button" @click="testReq1">测试请求1</button>
    <button class="uni-button" @click="testReq2">测试请求2</button>
    <view>----------------</view>
    <view>仓库数据1: {{ store.count }}</view>
    <view>仓库数据2: {{ store.doubleCount }}</view>
    <button class="uni-button" @click="store.increment">加1</button>
    <button class="uni-button" @click="store.decrement">减1</button>
  </view>
  <view class="top">
    <button class="uni-button" @click="clickFn">打开弹层</button>
    <custom-payment order-id="212121" :amount="89" ref="paymentRef"></custom-payment>
  </view>
</template>

<style lang="scss" scoped>
</style>
